import Info from '../../../components/InfoConfirmation'
import { connect } from 'dva'
const InfoModify = ({dispatch, modalControl, content}) => {
  // 提供tipModal数据 {}
  
  const listData = [
    {
      label: '姓名',
      value: 'name',
      initValue: 'jackwu',
      disabled: true,
    },
    {
      label: '身份证号',
      initValue: '362321199403220813',
      value: 'id',
      disabled: true,
    },
    {
      label: '有效期',
      type: 'doublePick',
      className: 'doublePick',
      startTime:{
        value:'start',
        time: new Date()
      },
      endTime:{
        value:'end',
        time: new Date()
      }
    },
    {
      label: '证件地址',
      value: 'address',
      initValue: '上海市徐汇区长乐路998号3801室',
      // 如果需要去除底部的边框可以添加此类名
      className: 'haveNoBorder',
      disabled: true
    },
    // 以下数据是日后页面需要用到的传参 主要是switch功能
    {
      label: '联系地址和身份证地址相同',
      value: 'contactAddressIsSame',
      initValue: false,
      type: 'switch',
      // 如果需要换行可以添加此类名
      className: 'changeLine',
      // 用户通过switch控制下面输入框的显示与隐藏
      children: {
        require: true,
        type: 'pickAddress',
        label: '地区',
        value: 'area',
        initValue: '',
        placeholder: '请选择地区',
        areaValue: 'contractAddress',
        areaPlaceholder: '请输入联系的地址，如：XX路XX号XX楼',
        areaLabel: '联系地址'
      },
    },
    {
      label: '邮政编码',
      value: 'postCode',
      initValue: '',
      disabled: false,
      className: 'requireSybol',
      rule: /^[1-9][0-9]{5}$/,
      require: true
    },
    {
      label: '电子邮箱',
      value: 'eMail',
      initValue: '',
      disabled: false,
      rule: /^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/
    },
    {
      label: '固定电话',
      value: 'fixedTel',
      initValue: '',
      disabled: false,
      className: 'haveNoBorder',
      rule: /^(0\d{2,3})-(\d{7,8})$/
    },
    {
      label: '职业',
      value: 'occupation',
      type: 'pick',
      initValue: '',
      require: true,
      data:[
        {
          label: '专业技术人员',
          value: '01'
        },
        {
          label: '办事人员和有关人员',
          value: '02'
        },
        {
          label: '文教科卫专业人员',
          value: '03'
        },
        {
          label: '社会生产服务和生活服务人员',
          value: '04'
        },
      ],
      disabled: false,
      className: 'changeLine requireSybol'
    },
    {
      label: '学历',
      value: 'education',
      type: 'pick',
      initValue: '',
      require: true,
      data:[
        {
          label: '博士',
          value: '01'
        },
        {
          label: '研究生',
          value: '02'
        },
        {
          label: '本科',
          value: '03'
        },
        {
          label: '专科',
          value: '04'
        },
        {
          label: '高中',
          value: '05'
        },
        {
          label: '专科',
          value: '06'
        },
        {
          label: '初中',
          value: '07'
        },
        {
          label: '小学',
          value: '08'
        },
      ],
      disabled: false,
      className: 'requireSybol'
    },
  ]
  const next = () => {
    dispatch({
      type: 'modules/getModules',
      payload: {
        pathname: '',
        businessId: '1231241230',
        process: 'baseInfoModify',
        title: '基本信息修改'
      }
    })
  }
  const InfoData = {
    listData,
    next,
    infoType: 'change',
    modalControl,
    content: content,
    closeModal: () => {
      dispatch({
        type: 'baseInfoModify/changeModal',
        payload: {
          modalControl: false
        }
      })
    },
    showModal: (content) => {
      dispatch({
        type: 'baseInfoModify/changeModal',
        payload: {
          modalControl: true,
          content
        }
      })
    }
  }
  return (
    <div>
      <Info {...InfoData}></Info>
    </div>
  )
}
export default connect(state => state.baseInfoModify)(InfoModify) 